﻿function getClientWidth() {
	return (
		window.innerWidth ? window.innerWidth : (document.documentElement ? document.documentElement.clientWidth : (document.body ? document.body.clientWidth : 0 ))
	);
};

function getClientHeight() {
	return (
		window.innerHeight ? window.innerHeight : (document.documentElement ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0 ))
	);
};

var onResizeWindow = function() {
    var oDom = YAHOO.util.Dom;
    
    var docHeight = getClientHeight();
    var docWidth = getClientWidth();
    
    var headerHeight = oDom.get('header').clientHeight;
    var mainHeight = oDom.get('main').clientHeight;
    var footerHeight = oDom.get('footer').clientHeight;
    
    
    if (YAHOO.env.ua.ie > 0 && YAHOO.env.ua.ie < 7) {
        var minHeight = docHeight - headerHeight - footerHeight - 50;
        if(minHeight < 276) {
            minHeight = 276;
        }
        if (oDom.getStyle('main', 'min-height') != ('' + (minHeight) + 'px')) {
            oDom.setStyle('main', 'min-height', '' + (minHeight) + 'px');
        }
    } else {
        var minHeight = docHeight - headerHeight - footerHeight - 27;
        if(minHeight < 276) {
            minHeight = 276;
        }
        if (oDom.getStyle('main', 'min-height') != ('' + (minHeight) + 'px')) {
            oDom.setStyle('main', 'min-height', '' + (minHeight) + 'px');
        }
    }
};

YAHOO.util.Event.onDOMReady(function() {
    onResizeWindow();
    window.onresize = onResizeWindow;
    
    NTTHAO.gridview.init('tbGrid');
}); 